bitkeeper revision 1.1159.1.329 (4186e250v4q4bACc3tLT1SAh95SQxw)
authormwilli2@equilibrium.research <mwilli2@equilibrium.research>
Tue, 2 Nov 2004 01:26:40 +0000 (01:26 +0000)
committermwilli2@equilibrium.research <mwilli2@equilibrium.research>
Tue, 2 Nov 2004 01:26:40 +0000 (01:26 +0000)
A coven of new wizards for Xensv (please test).  Some of this might
need refactoring but it should make the web interface more useful.

also: misc version updates, some extra docs stuff.

.rootkeys
docs/src/user.tex
tools/examples/xmexample1
tools/examples/xmexample2
tools/python/xen/sv/CreateDomain.py
tools/python/xen/sv/Main.py
tools/python/xen/sv/MigrateDomain.py [new file with mode: 0644]
tools/python/xen/sv/RestoreDomain.py [new file with mode: 0644]
tools/python/xen/sv/SaveDomain.py [new file with mode: 0644]

index 9dd3e38f593ca4bc5db1fd2f2dd99a6b02bfda69..cc0e349319e0a0f3c68a2edbf05d12650b58347b 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py
 40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/sv/HTMLBase.py
 40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py
+4186e24fZMp7_bX4f50MvUscdrST9Q tools/python/xen/sv/MigrateDomain.py
 40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py
+4186e24fb4YtJw155tNtSXXN6nEWqA tools/python/xen/sv/RestoreDomain.py
+4186e24fVXt0lfeQSAy1eiFKnPCHTg tools/python/xen/sv/SaveDomain.py
 40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py
 41052eb8UrgtUkuJPg7oY1tutVQHsg tools/python/xen/sv/Wizard.py
 40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py
index 299683e248695bd0a7e81191fbbec356bcb553b5..2db3ffbe5c170d230ec0709548d61a2fb9d9bf2c 100644 (file)
@@ -314,7 +314,7 @@ complicated.  The makefile needs a `pristine' Linux kernel tree to which
 it will then add the Xen architecture files.  You can tell the
 makefile the location of the appropriate Linux compressed tar file by
 setting the LINUX\_SRC environment variable, e.g. \\
-\verb!# LINUX_SRC=/tmp/linux-2.6.8.1.tar.bz2 make world! \\ or by
+\verb!# LINUX_SRC=/tmp/linux-2.6.9.tar.bz2 make world! \\ or by
 placing the tar file somewhere in the search path of {\tt
 LINUX\_SRC\_PATH} which defaults to `{\tt .:..}'.  If the makefile
 can't find a suitable kernel tar file it attempts to download it from
@@ -342,7 +342,7 @@ argument to make to get a parallel build.
 
 If you have an existing Linux kernel configuration that you would like
 to use for domain 0, you should copy it to
-install/boot/config-2.6.8.1-xen0.  During the first build, you may be
+install/boot/config-2.6.9-xen0.  During the first build, you may be
 asked about some Xen-specific options.  We advise accepting the
 defaults for these options.
 
@@ -364,8 +364,8 @@ destinations.
 Files in \path{install/boot/} include:
 \begin{itemize}
 \item \path{install/boot/xen.gz} The Xen 'kernel'
-\item \path{install/boot/vmlinuz-2.6.8.1-xen0}  Domain 0 XenLinux kernel
-\item \path{install/boot/vmlinuz-2.6.8.1-xenU}  Unprivileged XenLinux kernel
+\item \path{install/boot/vmlinuz-2.6.9-xen0}  Domain 0 XenLinux kernel
+\item \path{install/boot/vmlinuz-2.6.9-xenU}  Unprivileged XenLinux kernel
 \end{itemize}
 
 The difference between the two Linux kernels that are built is due to
@@ -379,7 +379,7 @@ domains.
 The \path{install/boot} directory will also contain the config files
 used for building the XenLinux kernels, and also versions of Xen and
 XenLinux kernels that contain debug symbols (\path{xen-syms} and
-\path{vmlinux-syms-2.6.8.1-xen0}) which are essential for interpreting crash
+\path{vmlinux-syms-2.6.9-xen0}) which are essential for interpreting crash
 dumps.  Retain these files as the developers may wish to see them if
 you post on the mailing list.
 
@@ -393,9 +393,9 @@ This file is sometimes called \path{menu.lst}, depending on your
 distribution.  The entry should look something like the following:
 
 \begin{verbatim}
-title Xen 2.0 / XenLinux 2.6.8.1
+title Xen 2.0 / XenLinux 2.6.9
   kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
-  module /boot/vmlinuz-2.6.8.1-xen0 root=/dev/sda4 ro console=tty0 console=ttyS0
+  module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro console=tty0 console=ttyS0
 \end{verbatim}
 
 The first line of the configuration (kernel...) tells GRUB where to
@@ -575,7 +575,7 @@ basics.
 \item Download the ttylinux disk image from XXX where from?
 \item Create a configuration file like the following:
 \begin{verbatim}
-kernel = "/boot/vmlinuz-2.6.8.1-xenU" # or a 2.4 kernel or a xen0 kernel
+kernel = "/boot/vmlinuz-2.6.9-xenU" # or a 2.4 kernel or a xen0 kernel
 memory = 64
 name = "ttylinux"
 cpu = -1 # leave to Xen to pick
@@ -905,9 +905,11 @@ docs to do advanced stuff.
 \chapter{Domain Configuration Files}
 \label{cha:config}
 
-XXX Could use a little explanation about possible values
+XX Could use a little explanation about possible values
 
-Xen configuration files contain the following standard variables:
+Xen configuration files contain the following standard variables.
+Unless otherwise stated, configuration items should be enclosed in
+quotes (i.e. {\tt '...'} or {\tt ``....''})):
 
 \begin{description}
 \item[kernel] Path to the kernel image (on the server).
@@ -916,8 +918,20 @@ Xen configuration files contain the following standard variables:
 \item[memory] Memory size in megabytes.
 \item[cpu] CPU to assign this domain to.
 \item[nics] Number of virtual network interfaces.
-\item[vif] List of MAC addresses (random addresses are assigned if not given).
-\item[disk] Regions of disk to export to the domain.
+\item[vif] List of MAC addresses (random addresses are assigned if not given) and /
+  or bridges to use for the domains network interfaces. e.g. \\
+  \verb_vif = [ 'mac=aa:00:00:00:00:11, bridge=xen-br0', 'bridge=xen-br1' ]_
+  to assign a MAC address and bridge to the first interface and assign a
+  different bridge to the second interface, leaving Xend to choose the MAC
+  address.
+\item[disk] List of block devices to export to the domain.  e.g. \\
+  \verb_disk = [ 'phy:hda1,sda1,r' ]_ \\
+  exports device \path{/dev/hda1} to the domain, as \path{/dev/sda1} with
+  readonly access being allowed. \\
+  \verb_disk = [ 'phy:hda7,sda2,w', 'phy:hdb2,sda,w!' ]_ \\
+  exports device \path{/dev/hda7} to the domain as \path{/dev/sda2} with
+  write access enabled and \path{/dev/hdb2} as \path{/dev/sda} with write access
+  force enabled (bypassing safety checks).
 \item[dhcp] Set to {\tt 'dhcp'} if you want to DHCP allocate the IP address.
 \item[netmask] IP netmask.
 \item[gateway] IP address for the gateway (if any).
index e9c7315a3b7d9e3dd5fd99d7a9236637415ef7c2..cdf4b6c82457fc8c2c253383614346d79da54157 100644 (file)
@@ -8,7 +8,7 @@
 
 #----------------------------------------------------------------------------
 # Kernel image file.
-kernel = "/boot/vmlinuz-2.6.8.1-xenU"
+kernel = "/boot/vmlinuz-2.6.9-xenU"
 
 # Optional ramdisk.
 #ramdisk = "/boot/initrd.gz"
index c7c5d3b54ff866ca68580ecd137312c407aa44f8..61479ca5f0693ed08768e87e259b7ceae42f02bb 100644 (file)
@@ -36,7 +36,7 @@ xm_vars.check()
 
 #----------------------------------------------------------------------------
 # Kernel image file.
-kernel = "/boot/vmlinuz-2.6.8.1-xenU"
+kernel = "/boot/vmlinuz-2.6.9-xenU"
 
 # Optional ramdisk.
 #ramdisk = "/boot/initrd.gz"
index ebacf9eb74f5699335d43f25f7e2839f36ad3f1a..4378897e5c8ba9c3d314329dbd57ec522a8b0c10 100644 (file)
@@ -16,7 +16,7 @@ class CreateDomain( Wizard ):
                    CreatePage4,
                    CreateFinish ]
     
-       Wizard.__init__( self, urlWriter, "Create Domain Wizard", sheets )
+       Wizard.__init__( self, urlWriter, "Create Domain", sheets )
        
 class CreatePage0( Sheet ):
 
@@ -31,7 +31,8 @@ class CreatePage1( Sheet ):
 
     def __init__( self, urlWriter ):
         Sheet.__init__( self, urlWriter, "Setup Kernel Image", 1 )
-        self.addControl( ListControl( 'builder', [('linux', 'Linux'), ('netbsd', 'NetBSD')], 'Kernel Type:' ) )
+# For now we don't need to select a builder...
+#        self.addControl( ListControl( 'builder', [('linux', 'Linux'), ('netbsd', 'NetBSD')], 'Kernel Type:' ) )
         self.addControl( FileControl( 'kernel', '/boot/vmlinuz-2.6.9-xenU', 'Kernel Image:' ) )
         self.addControl( InputControl( 'extra', '', 'Kernel Command Line Parameters:' ) )
 
index 402c24a511578a70793248642776f629590490b8..196e1c1450759f013c878b796fd2f9d554586b5a 100755 (executable)
@@ -3,6 +3,9 @@ from xen.sv.DomList  import DomList
 from xen.sv.NodeInfo import NodeInfo
 from xen.sv.DomInfo  import DomInfo
 from xen.sv.CreateDomain import CreateDomain
+from xen.sv.MigrateDomain import MigrateDomain
+from xen.sv.SaveDomain import SaveDomain
+from xen.sv.RestoreDomain import RestoreDomain
 
 from xen.xend.XendClient import server
 
@@ -16,7 +19,14 @@ class Main( HTMLBase ):
         self.modules = { "node": NodeInfo, 
                          "list": DomList, 
                          "info": DomInfo,
-                         "create": CreateDomain }
+                         "create": CreateDomain,
+                         "migrate" : MigrateDomain,
+                         "save" : SaveDomain,
+                         "restore" : RestoreDomain }
+
+        # ordered list of module menus to display
+        self.module_menus = [ "node", "create", "migrate", "save",
+                              "restore", "list" ]
         HTMLBase.__init__(self)
         
     def render_POST( self, request ):
@@ -53,10 +63,10 @@ class Main( HTMLBase ):
         request.write( "   <img src='images/xen.png' width='150' height='75' border='0'/></a><br/></td></tr>" )
         request.write( "   <tr><td height='60px' align='center'><p class='small'>SV Web Interface<br/>(C) <a href='mailto:tw275@cam.ac.uk'>Tom Wilkie</a> 2004</p></td></tr>")
         request.write( "   <tr><td align='center' valign='top'>" )
-        
-        for (modName, module) in self.modules.items():
-            module( self.mainUrlWriter( modName ) ).write_MENU( request )
 
+        for modName in self.module_menus:
+            self.modules[modName]( self.mainUrlWriter( modName ) ).write_MENU( request )
+        
         request.write( "   </td></tr>" )
         request.write( "  </table>" )
         request.write( " &nbsp;" )
diff --git a/tools/python/xen/sv/MigrateDomain.py b/tools/python/xen/sv/MigrateDomain.py
new file mode 100644 (file)
index 0000000..928acf3
--- /dev/null
@@ -0,0 +1,72 @@
+from xen.sv.Wizard import *
+from xen.sv.util import *
+from xen.sv.GenTabbed import PreTab
+
+from xen.xm.create import make_config, OptVals
+
+from xen.xend.XendClient import server
+
+class MigrateDomain( Wizard ):
+    def __init__( self, urlWriter ):
+
+        sheets = [ ChooseMigrateDomain,
+                   DoMigrate ]
+
+        Wizard.__init__( self, urlWriter, "Migrate Domain", sheets )
+
+
+class ChooseMigrateDomain( Sheet ):
+    def __init__( self, urlWriter ):
+        Sheet.__init__( self, urlWriter, "Configure Migration", 0)
+        try:
+            domains = server.xend_domains()
+            domains.sort()
+        except:
+            pass
+
+        domnames = []
+        for i in domains:
+            if i != 'Domain-0': domnames.append((i,i))
+        
+        self.addControl( ListControl('domid',
+                                     domnames,
+                                     'Domain ID:') )
+        self.addControl( TickControl('live',
+                                     'True',
+                                     'Live migrate:') )
+        self.addControl( InputControl('rate',
+                                      '0',
+                                      'Rate limit:') )
+        self.addControl( InputControl( 'dest', 'myhost.mydomain',
+                                       'Name or IP address:',
+                                       ".*") )
+
+class DoMigrate( Sheet ):
+    def __init__(self, urlWriter ):
+        Sheet.__init__(self, urlWriter, "Migration Done", 1)
+
+    def write_BODY( self, request, err ):
+
+        if not self.passback: self.parseForm( request )
+
+#        print string2sxp(self.passback)
+        
+        config = ssxp2hash ( string2sxp( self.passback ) )
+      
+        try:
+            print config
+            print config['domid'], config['dest']
+            dom_sxp = server.xend_domain_migrate( config['domid'],
+                                                  config['dest'],
+                                                  config.get('live') == 'True',
+                                                  config['rate'] )
+            success = "Your domain was successfully Migrated.\n"
+        except Exception, e:
+            success = "There was an error migrating your domain\n"
+            dom_sxp = str(e)
+        
+        pt = PreTab( success + dom_sxp ) # sxp2prettystring( dom_sxp ) )
+        pt.write_BODY( request )
+
+        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
+        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )
diff --git a/tools/python/xen/sv/RestoreDomain.py b/tools/python/xen/sv/RestoreDomain.py
new file mode 100644 (file)
index 0000000..be8b4f5
--- /dev/null
@@ -0,0 +1,46 @@
+from xen.sv.Wizard import *
+from xen.sv.util import *
+from xen.sv.GenTabbed import PreTab
+
+from xen.xm.create import make_config, OptVals
+
+from xen.xend.XendClient import server
+
+class RestoreDomain( Wizard ):
+    def __init__( self, urlWriter ):
+
+        sheets = [ ChooseRestoreDomain,
+                   DoRestore ]
+
+        Wizard.__init__( self, urlWriter, "Restore Domain", sheets )
+
+
+class ChooseRestoreDomain( Sheet ):
+    def __init__( self, urlWriter ):
+        Sheet.__init__( self, urlWriter, "Configure Restore", 0)
+        
+        self.addControl( InputControl( 'file', '',
+                                       'Suspend file name:',
+                                       ".*") )
+
+class DoRestore( Sheet ):
+    def __init__(self, urlWriter ):
+        Sheet.__init__(self, urlWriter, "Restore Done", 1)
+
+    def write_BODY( self, request, err ):
+
+        if not self.passback: self.parseForm( request )
+        config = ssxp2hash ( string2sxp( self.passback ) )
+      
+        try:
+            dom_sxp = server.xend_domain_restore( config['file'] )
+            success = "Your domain was successfully restored.\n"
+        except Exception, e:
+            success = "There was an error restoring your domain\n"
+            dom_sxp = str(e)
+        
+        pt = PreTab( success + sxp2prettystring( dom_sxp ) )
+        pt.write_BODY( request )
+
+        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
+        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )
diff --git a/tools/python/xen/sv/SaveDomain.py b/tools/python/xen/sv/SaveDomain.py
new file mode 100644 (file)
index 0000000..4c4e315
--- /dev/null
@@ -0,0 +1,59 @@
+from xen.sv.Wizard import *
+from xen.sv.util import *
+from xen.sv.GenTabbed import PreTab
+
+from xen.xm.create import make_config, OptVals
+
+from xen.xend.XendClient import server
+
+class SaveDomain( Wizard ):
+    def __init__( self, urlWriter ):
+
+        sheets = [ ChooseSaveDomain,
+                   DoSave ]
+
+        Wizard.__init__( self, urlWriter, "Save Domain", sheets )
+
+
+class ChooseSaveDomain( Sheet ):
+    def __init__( self, urlWriter ):
+        Sheet.__init__( self, urlWriter, "Configure Save", 0)
+        try:
+            domains = server.xend_domains()
+            domains.sort()
+        except:
+            pass
+
+        domnames = []
+        for i in domains:
+            if i != 'Domain-0': domnames.append((i,i))
+        
+        self.addControl( ListControl('domid',
+                                     domnames,
+                                     'Domain ID:') )
+        self.addControl( InputControl( 'file', '',
+                                       'Suspend file name:',
+                                       ".*") )
+
+class DoSave( Sheet ):
+    def __init__(self, urlWriter ):
+        Sheet.__init__(self, urlWriter, "Save Done", 1)
+
+    def write_BODY( self, request, err ):
+
+        if not self.passback: self.parseForm( request )
+        config = ssxp2hash ( string2sxp( self.passback ) )
+      
+        try:
+            dom_sxp = server.xend_domain_save( config['domid'],
+                                                  config['file'] )
+            success = "Your domain was successfully saved.\n"
+        except Exception, e:
+            success = "There was an error saving your domain\n"
+            dom_sxp = str(e)
+        
+        pt = PreTab( success + dom_sxp ) # sxp2prettystring( dom_sxp ) )
+        pt.write_BODY( request )
+
+        request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
+        request.write( "<input type='hidden' name='sheet' value='%s'></p>" % self.location )